package org.jeecgframework.codegenerate.database;

public class DbTypeUtil {
 public static boolean isMysql(String jdbcUrl) {//a
     return checkDb(jdbcUrl, "mysql") || checkDb(jdbcUrl, "mariadb") || checkDb(jdbcUrl, "sqlite") || checkDb(jdbcUrl, "clickhouse") || checkDb(jdbcUrl, "polardb");
 }

 public static boolean isOracle(String jdbcUrl) {//b
     return checkDb(jdbcUrl, "oracle9i") || checkDb(jdbcUrl, "oracle") || checkDb(jdbcUrl, "dm") || checkDb(jdbcUrl, "edb");
 }

 public static boolean issqlserver(String jdbcUrl) {//c
     return checkDb(jdbcUrl, "sqlserver") || checkDb(jdbcUrl, "sqlserver2012") || checkDb(jdbcUrl, "derby");
 }

 public static boolean ispostgresql(String jdbcUrl) {//d
     return checkDb(jdbcUrl, "postgresql") || checkDb(jdbcUrl, "kingbase") || checkDb(jdbcUrl, "zenith");
 }

 private static boolean checkDb(String jdbcUrl, String sqlType) {
     return jdbcUrl.toLowerCase().contains("jdbc:" + sqlType);
 }
}
